package yf.mall.service.app;

import com.github.pagehelper.PageInfo;
import com.yf.service.BaseService;
import yf.mall.entity.DyAccountAuthEntity;
import yf.mall.entity.DyAccountAuthEntityExample;
import yf.mall.entity.custom.PageQuery;
import yf.mall.vo.DyAccountAuthVo;

import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;

/**
 * 抖音账户授权表Service接口
 *
 *
 *
 * @date Tue Jul 18 14:30:26 CST 2023
 */
public interface DyAccountAuthService extends BaseService<DyAccountAuthEntity> {

    /************自动生成**************/
    List<DyAccountAuthVo> findVo(DyAccountAuthVo vo);

        DyAccountAuthVo getVo(Long id);

     int updateVo(DyAccountAuthVo vo);

       int saveVo(DyAccountAuthVo vo);

    void downLoad(HttpServletResponse response, List<DyAccountAuthVo> list);

    void upload(InputStream file);

    /***********BACK***********/




    /***********API***********/

    /**
     *  创建抖音授权关联信息
     * @param authEntity 用户信息
     * @return
     */
    boolean createAccountAuth(DyAccountAuthEntity authEntity);

    /**
     * 查询抖音授权信息
     * @param userId 用户id
     * @return
     */
    DyAccountAuthEntity getMasterAuthByUserId(Long userId);

    /**
     * 查询全部的抖音授权信息
     * @param userId 用户id
     * @return
     */
    List<DyAccountAuthEntity> getAllAuthByUser(Long userId);

    /**
     * 根据openid查询授权用户信息
     * @param openIds
     * @return
     */
    List<DyAccountAuthEntity> getAuthByOpenIds(List<String> openIds);

    /**
     * 获取系统默认的token
     * @return
     */
    DyAccountAuthEntity getDefaultToken();

    /**
     * 分页查询
     * @param example
     * @param pageQuery
     * @return
     */
    PageInfo<DyAccountAuthEntity> findUser(DyAccountAuthEntityExample example, PageQuery pageQuery);

    /**
     * 通过抖音openId查询
     * @param openId
     * @return
     */
    DyAccountAuthEntity getAuthByOpenId(String openId);

    /**
     * 更新授权信息，userId和openId必传
     * @param authEntity
     * @return
     */
    boolean updateAuthToken(DyAccountAuthEntity authEntity);

    /**
     * 通过用户和抖音号查询授权信息
     * @param userId
     * @param displayId
     * @return
     */
    DyAccountAuthEntity getAuthByUserAndDisplayId(Long userId,String displayId);
}

